<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/inc/sessionCheck.jsp" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display"%>
<%@ taglib uri="/WEB-INF/config/tld/fmt.tld" prefix="fmt"%>
<%@ taglib uri="http://ssh.org/selects" prefix="ssh"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
	String applicationPath = basePath + "/" + "application";
	String roleName = request.getAttribute("RoleName")==null?null:request.getAttribute("RoleName").toString();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title><bean:message key='com.application.systemmanager.notice_list' /></title>
		<link href="<%=path%>/css/jinmu_style.css" rel="stylesheet" type="text/css" />
		<script language="javascript" src="<%=path%>/js/util.js"></script>
	</head>
	<body>
	    <html:form styleId="noticeForm" action="listNotice.do?method=getNoticePartialList" styleClass="simple">
	        <input type="hidden" id="totalPage" value="${totalPage}"/>
			<table cellspacing="0" cellpadding="0" width="98%" align="center"  border="0" class="margtb5">
		    <tr>
		      <td align="left" class="padl5 lan12"><img src="<%=path%>/images/img-11.gif" width="12" height="12">&nbsp;我的工作台 &gt; 通知公告</td>
		    </tr>
		  </table>
				<table cellspacing="3" cellpadding="0" width="98%" align="center"  border="0" class="kuang2 margtb5 hei12">
						 <tr>
			              <td width="6%" align="right"><bean:message key="com.application.systemmanager.notice_title"/>：</td>
			              <td width="15%"><html:text property="noticeTitle"/></td>
						  <td align="right" width="6%"><bean:message key="com.application.systemmanager.notice_type"/>：</td>
			              <td width="25%">
						     <ssh:select propertyName="noticeType" pid="NOTICE_TYPE" type="1" defaultName="${noticeForm.noticeType}"/>
					      </td>
					      </tr>
					      <tr>
			              <td width="9%" align="right"><bean:message key="com.application.systemmanager.notice_date"/>：</td>
			              <td width="35%"><html:text readonly="true" property="startDate" onclick="popUpCalendarDlg(this)"/>
			              至
			                 <html:text  readonly="true" property="endDate" onclick="popUpCalendarDlg(this)"/></td>
			              <td width="10%" align="right" class="padr10"><input class="buttonbg" id="but_query" type="button" value="<bean:message key='com.application.systemmanager.query'/>" name="but_query" onClick="query();" /></td>
			            </tr>

			</table>
			
			
  
   <table cellspacing="0" cellpadding="0" width="98%" align="center"  border="0" class="margb5">
 
   
     <tr>
        <td colspan="8" class="bgcolor2 padlr5">
    		<table border="0" cellspacing="0" cellpadding="0" class="lan13b">
	      <tr>
		  <td width="25" align="center"><img src="<%=applicationPath%>/images/tianjia.gif" alt="<bean:message key='com.application.systemmanager.add'/>" height="15" width="15" /></td>
		  <td class="lieb-zi" width="40"><a href="#" onClick="addNote();" ><bean:message key='com.application.systemmanager.add'/></a></td>

		  <td width="25" align="center"><img src="<%=applicationPath%>/images/bianji.gif" alt="<bean:message key='com.application.systemmanager.modify'/>" height="15" width="15" /></td>
		  <td class="lieb-zi"  width="40"><a href="#" onClick="modifyNote();" ><bean:message key='com.application.systemmanager.modify'/></a></td>

		  <td width="25" align="center"><img src="<%=applicationPath%>/images/shanchu.gif" alt="<bean:message key='com.application.systemmanager.del'/>" height="15" width="15" /></td>
		  <td class="lieb-zi"  width="40"><a href="#" onClick="delNote();" ><bean:message key='com.application.systemmanager.del'/></a></td>


		  <td width="25" align="center"><img src="<%=applicationPath%>/images/chakan.gif" alt="<bean:message key='com.application.systemmanager.view'/>" height="15" width="15"/></td>
		  <td width="40" class="lieb-zi"><a href="#" onClick="view();"><bean:message key='com.application.systemmanager.view'/></a></td>
		  <td class="lieb-zi">&nbsp;</td>
	       </tr>
	      </table> 
	      
	</td>
	</tr>

 
			<tr>
				<td>
					<fmt:bundle basename="com.application.systemmanager.struts.ApplicationResources">
				        <display:table   style="width:100%;"  name="noticeList" class="simple" id="notice" pagesize="15" partialList="true" defaultsort="1" defaultorder="descending" size="resultSize" requestURI="listNotice.do?method=getNoticePartialList"  > 
						<display:setProperty name="sort.amount" value="noticeList"/>
				
						<display:column   style="width:5%; text-align:center;"   title="选择" >
						    <input type="checkbox" name="id" value="${notice.id}" />
						</display:column>
			
 
						<display:column  style="width:30%; text-align:center;" sortable="true" titleKey="com.application.systemmanager.notice_title" >
						   <a href="#" style="color:blue;" onclick="showNotice('${notice.id}')">${notice.noticeTitle}</a> 
				        </display:column>
						<display:column  style="width:10%; text-align:center;" property="noticeType" titleKey="com.application.systemmanager.notice_type" 
							maxLength="5" sortable="true"  value="23" decorator="com.manager.commons.DictCodeColumnDecorator" dictCode="NOTICE_TYPE"/>
						<display:column  style="width:10%; text-align:center;" property="noticePerson" titleKey="com.application.systemmanager.notice_person" sortable="true"
							 />
						<display:column  style="width:10%; text-align:center;" property="noticeDate" titleKey="com.application.systemmanager.notice_date" sortable="true"
							/>
					</display:table>
	              </fmt:bundle>
				</td>
			</tr>
		</table>
     </html:form>
	</body>
</html>
<script>



function query(){
	document.forms[0].action="listNotice.do?method=getNoticePartialList";
	document.forms[0].submit();
}

//新增公告
function addNote(){
    document.forms[0].action="toAddNotice.do?method=toAddNotice";
	document.forms[0].submit();
}

//修改项目公告
function modifyNote(){
    var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	    alert("一次只能修改一条记录！");
		return;
	}else{
		document.forms[0].action="toUpdateNotice.do?method=toUpdateNotice";
	    document.forms[0].submit();
	}
	
}

//删除项目公告
function delNote()
{
	var ids = getSelectedIds('id');
	if( ids=="" )
	{
		alert("请选择一条记录！");
		return false;
	}
	if( confirm("是否要删除所选的信息？") )
	{
	    document.forms[0].action="deleteNotice.do?method=deleteNotice&ids=" + ids;
		document.forms[0].submit();
	}
}
	
	
function validateSelect(){ 
    var count = 0;
    var jysBox = $s("id");
    for(var i=0;i<jysBox.length;i++){
		if(jysBox[i].checked){
        	count++;
		}
	}
    return count;
}

//查看公告
function view(){
	var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	    alert("一次只能查看一条记录！");
		return;
	}else{
	    var id = getSelectedIds('id');
		showNotice(id);
	}
}


//全选   
function checkAll()   
{ 
  
   var chk=document.getElementsByName("id");   
   for(var i=0;i<chk.length;i++)   
   { 
     if($('checkall').checked){
     	chk(i).checked=true; 
     }else{
        chk(i).checked=false; 
     } 
       
 }
  
}   

//查看通知
function showNotice(id){ 
    document.forms[0].action="workBench.do?method=showNotice&bussinessID=" + id;
	document.forms[0].submit();
	/**
     var url = "workBench.do?method=showNotice&bussinessID=" + id;
    openWindow(url,1000,600);
    **/
}
</script>
